<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>意达设计</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../css/dealer.css"/>
    <style>.inline{display:inline-block;}</style>
</head>
<body class="body">

<!-- header -->
<div class="pageheader"><a href="javascript:void(0)" onclick="api.closeWin();" class="return"></a><span>财务统计</span></div>

<!-- content -->
<div class="statis">
	<div class="stali">
		<p>总消费金额(元)</p>
		<span id='total'>32,767.66</span>
	</div>
	<div class="stali">
		<p>月消费金额（元）</p>
		<span id='month'>168,789.23</span>
	</div>
</div>
<style type="text/css">
    #dateSelectorOne{
        display: block;
        width: 2.6rem;
        height: .6rem;
        color: #666;
        background: url(../image/icon/icon-046.png) no-repeat right;
        background-size: .32rem;
    }
</style>
<div class="statit">
    <p style="width:1.2rem">消费明细</p><p id="showtic"></p>
    

    <input type="text" id="dateSelectorOne" placeholder="" >
 </div>
<div class="stalie">
	<ul id='con'>
		 <li>
                    <div class="stalie_l">
                        <div class="stalieimg"><img src="../image/dealer/img-005.jpg"></div>
                        <div class="stalietxt">
                            <p>订单号：2018091216292326</p>
                            <span style="display: inline-block;margin-right:.2rem">[女士挎包]</span><span style="display: inline-block;">[女士挎包]</span>
                        </div>
                    </div>
                    <div class="stalie_r">
                        <p>3000.00</p>
                        <span>09-12  16:37</span>
                    </div>
                </li>
        
	</ul>
</div>






</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../script/adaptive.js"></script>
<script type="text/javascript" src="../script/swiper.min.js"></script>
<script type="text/javascript" src="../script/tabs.js"></script>
<script type="text/javascript">
    window['adaptive'].desinWidth = 750;
    window['adaptive'].baseFont = 28;
    window['adaptive'].maxWidth = 750;
    window['adaptive'].init();

var page=1;
var date='';
var p='';
    apiready = function () {
        $api.fixStatusBar($api.dom('.header'));
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err){
            api.closeWidget();
        });
        api.showProgress();

        
        

        var para=api.pageParam;
        

    	

        toDoRequest();

        api. addEventListener({name:'scrolltobottom'}, function(ret, err){
            
            toDoRequest();

        });

        
        
        
    

  };
  function toDoRequest(){

            p={token:token,page:page,date:date};

            api.ajax({
                url: webSiteUrl+'/app/user/caiwu',
                method: 'post',
                data: {
                    values:p,
                }
            }, function(ret, err) {
                api.hideProgress();
                
                if(ret.code==200){
                    
                    
                    $('#total').html(ret.data.total);
                    $('#month').html(ret.data.month);
                    if(isvip==2){
                        var aaa="<p class='inline'>(我的提成:</p><p id='tic' class='inline'>"+ret.data.tic+"</p><p class='inline'>元)</p>"
                        $('#showtic').html(aaa);
                    }
                    
                    html = "";
                    var tj=ret.data.data;
                    
                    if(tj!=null){

                        for(var i=0;i<tj.length;i++){
html+='<li  onclick="caiwudetail('+tj[i].id+')"><div class="stalie_l"><div class="stalieimg"><img src="'+webSiteUrl+tj[i].icon+'" style="width:40px;"></div><div class="stalietxt"><p>订单号：'+tj[i].orderno+'</p>';

if(isvip==2){
  html+='<span style="display: inline-block;margin-right:.2rem">'+tj[i].time+'</span>';  
}

html+='<span style="display: inline-block;">['+tj[i].name+']</span></div></div><div class="stalie_r"><p>'+tj[i].money+'</p>';

if(isvip==2){
    html+='<span>提成:'+tj[i].tic+'</span></div></li>';
}else{
    html+='<span>'+tj[i].time+'</span></div></li>';
}


                        }

                        if(page==1){
                            $('#con').html(html);
                        }else{
                            $('#con').append(html);
                        }
                        page++;

                    }else{
                        if(page==1){
                            $('#con').html('<p style="text-align:center">暂无数据</p>');
                        }
                    }
                    
                    
                }

            });
        }

    function switchorder() {
            page=1;
            
            var stime='';
            var etime='';
            p={token:token,type:1,page:page,stime:stime,etime:etime};
    }
    function caiwudetail(id){
        api.openWin({
            name: 'shopName',
            url: './caiwudetail.html',
            pageParam: {
                id: id
            }
        });
    }
    $(document).on('click','#dateSure',function(){  
        var day=$('#dateSelectorOne').val();
        
        if(day != ''){
            

            date=day;
            page=1;
            toDoRequest();
        }
    })
         

</script>
<script type="text/javascript" src="../Mdate/iScroll.js"></script>
<script type="text/javascript" src="../Mdate/Mdate.js"></script>
<script type="text/javascript">
    //new Mdate("dateSelectorOne");
    new Mdate("dateSelectorOne", {
    //"dateShowBtn"为你点击触发Mdate的id，必填项
    acceptId: "dateSelectorOne",
    //此项为你要显示选择后的日期的input，不填写默认为上一行的"dateShowBtn"
    beginYear: "2015",
    //此项为Mdate的初始年份，不填写默认为2000
    //beginMonth: "10",
    //此项为Mdate的初始月份，不填写默认为1
    //beginDay: "24",
    //此项为Mdate的初始日期，不填写默认为1
    endYear: "2030",
    //此项为Mdate的结束年份，不填写默认为当年
    //endMonth: "1",
    //此项为Mdate的结束月份，不填写默认为当月
    //endDay: "1",
    //此项为Mdate的结束日期，不填写默认为当天
    //format: "-"
    //此项为Mdate需要显示的格式，可填写"/"或"-"或".",不填写默认为年月日
})
</script>

</html>
